package com.lvw.weather.forcast.web.fallback;

import com.lvw.weather.dto.Weather;
import com.lvw.weather.forcast.web.IForcastAPI;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Component
public class ForcastAPIFallback implements IForcastAPI {
    @Override
    public String forcast(String city) {
        return "--- Service fallback: forcast()";
    }

    @Override
    public List<String> forcasts(List<String> citys) {

        return citys.stream()
                .map(s -> "--- Service fallback: forcasts")
                .collect(Collectors.toList());
    }

    @Override
    public boolean updateForcast(String city, Weather weather) {
        return false;
    }
}
